#include <iostream>
#include <vector>
using namespace std;

class Solution {
public:
    bool lemonadeChange(vector<int>& bills) {
        int five = 0;
        int ten = 0;
        for (auto e : bills)
        {
            if (e == 5)
                ++five;
            else if (e == 10)
            {
                ++ten;
                if (five > 0)
                    --five;
                else
                    return false;
            }
            else
            {
                if (ten > 0)
                {
                    --ten;
                    if (five > 0)
                        --five;
                    else
                        return false;
                }
                else
                {
                    if (five >= 3)
                        five -= 3;
                    else
                        return false;
                }
            }
        }
        return true;
    }
};

int main()
{
	return 0;
}